import json

from ronglian_sms_sdk import SmsSDK
class SendCode:
    def __init__(self):
        self.accId = '2c94811c936de29c019370537a680038'
        self.accToken = 'e52d0277cbde4e0091565a76fe265e04'
        self.appId = '2c94811c936de29c01937057b029006b'

    def send_message(self,phone,code):
        sdk = SmsSDK(self.accId, self.accToken, self.appId)
        tid = '1'
        mobile = phone
        datas = (code,)
        resp = json.loads(sdk.sendMessage(tid, mobile, datas))
        if resp['statusCode'] == '000000':
            return True
        else:
            return False